// 将范型，转为value为key的对象
type TupleToObject<T extends readonly any[]> = {
  [P in T[number]]: P; // T[number] 获取到范型中的每个值
};
const tuple = ["tesla", "model 3", "model X", "model Y"] as const;
type result = TupleToObject<typeof tuple>; // { 'tesla': 'tesla', 'model 3': 'model 3', 'model X': 'model X', 'model Y': 'model Y'}
const res: result = {
  tesla: "tesla",
  "model 3": "model 3",
  "model X": "model X",
  "model Y": "model Y",
};
